.PHONY= doc clean

CC=g++
OPTIONS= -g 
DEBUG= #-D DEBUG
LIBDIR=lib
INCLUDEDIR=include
_OBJ= tporo.o tvectorporo.o tpilaporo.o tlistaporo.o
OBJ = $(patsubst %,$(LIBDIR)/%,$(_OBJ))
DIR = ./TADS/TPoro/
DIR2 = ./TADS/tvectorporo/
DIR3 = ./TADS/tpilaporo/

TPilaPoro: clean
	cp $(DIR3)tad01.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida1 2>valgrind1
	diff -y ./salida1 $(DIR3)tad01.cpp.sal | cat >difer1
	clear
	
	cp $(DIR3)tad02.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida2 2>valgrind2
	diff -y ./salida2 $(DIR3)tad02.cpp.sal | cat >difer2
	clear
	
	cp $(DIR3)tad03.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida3 2>valgrind3
	diff -y ./salida3 $(DIR3)tad03.cpp.sal | cat >difer3
	clear
	
	cp $(DIR3)tad04.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida4 2>valgrind4
	diff -y ./salida4 $(DIR3)tad04.cpp.sal | cat >difer4
	clear
	
	cp $(DIR3)tad05.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida5 2>valgrind5
	diff -y ./salida5 $(DIR3)tad05.cpp.sal | cat >difer5
	clear
	
	cp $(DIR3)tad06.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida6 2>valgrind6
	diff -y ./salida6 $(DIR3)tad06.cpp.sal | cat >difer6
	clear
	
	cp $(DIR3)tad07.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida7 2>valgrind7
	diff -y ./salida7 $(DIR3)tad07.cpp.sal | cat >difer7
	clear
	
	cp $(DIR3)tad08.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida8 2>valgrind8
	diff -y ./salida8 $(DIR3)tad08.cpp.sal | cat >difer8
	clear
	
	cp $(DIR3)tad09.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida9 2>valgrind9
	diff -y ./salida9 $(DIR3)tad09.cpp.sal | cat >difer9
	clear
	
	cp $(DIR3)tad10.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida10 2>valgrind10
	diff -y ./salida10 $(DIR3)tad10.cpp.sal | cat >difer10
	clear
	
	#rm -f salida*
	gedit ./difer* ./valgrind* &
	#gedit ./salida* $(DIR3)*.cpp.sal &
	clear


TVectorPoro: clean
	cp $(DIR2)tad01.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida1 2>valgrind1
	diff -y ./salida1 $(DIR2)tad01.cpp.sal | cat >difer1
	cp $(DIR2)tad02.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida2 2>valgrind2
	diff -y ./salida2 $(DIR2)tad02.cpp.sal | cat >difer2
	cp $(DIR2)tad03.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida3 2>valgrind3
	diff -y ./salida3 $(DIR2)tad03.cpp.sal | cat >difer3
	cp $(DIR2)tad04.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida4 2>valgrind4
	diff -y ./salida4 $(DIR2)tad04.cpp.sal | cat >difer4
	cp $(DIR2)tad05.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida5 2>valgrind5
	diff -y ./salida5 $(DIR2)tad05.cpp.sal | cat >difer5
	cp $(DIR2)tad06.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida6 2>valgrind6
	diff -y ./salida6 $(DIR2)tad06.cpp.sal | cat >difer6
	cp $(DIR2)tad07.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida7 2>valgrind7
	diff -y ./salida7 $(DIR2)tad07.cpp.sal | cat >difer7
	cp $(DIR2)tad08.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida8 2>valgrind8
	diff -y ./salida8 $(DIR2)tad08.cpp.sal | cat >difer8

	
	#rm -f salida*
	#gedit ./difer* ./valgrind* &
	gedit ./salida* $(DIR2)*.cpp.sal &
	clear

TPoro: clean
	cp $(DIR)tad01TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida1 2>valgrind1
	diff -y ./salida1 $(DIR)tad01TPoro.cpp.sal | cat >difer1
	cp $(DIR)tad02TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida2 2>valgrind2
	diff -y ./salida2 $(DIR)tad02TPoro.cpp.sal | cat >difer2
	cp $(DIR)tad03TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida3 2>valgrind3
	diff -y ./salida3 $(DIR)tad03TPoro.cpp.sal | cat >difer3
	cp $(DIR)tad04TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida4 2>valgrind4
	diff -y ./salida4 $(DIR)tad04TPoro.cpp.sal | cat >difer4
	cp $(DIR)tad05TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida5 2>valgrind5
	diff -y ./salida5 $(DIR)tad05TPoro.cpp.sal | cat >difer5
	cp $(DIR)tad06TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida6 2>valgrind6
	diff -y ./salida6 $(DIR)tad06TPoro.cpp.sal | cat >difer6
	cp $(DIR)tad07TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida7 2>valgrind7
	diff -y ./salida7 $(DIR)tad07TPoro.cpp.sal | cat >difer7
	cp $(DIR)tad08TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida8 2>valgrind8
	diff -y ./salida8 $(DIR)tad08TPoro.cpp.sal | cat >difer8
	cp $(DIR)tad09TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida9 2>valgrind9
	diff -y ./salida9 $(DIR)tad09TPoro.cpp.sal | cat >difer9
	cp $(DIR)tad10TPoro.cpp ./src/tad.cpp
	make tad
	valgrind --leak-check=full ./tad > salida10 2>valgrind10
	diff -y ./salida10 $(DIR)tad10TPoro.cpp.sal | cat >difer10
	
	#rm -f salida*
	#gedit ./difer* ./valgrind* &
	gedit ./salida* $(DIR2)*.cpp.sal &
	clear
	
D:
	geany ./lib/*.cpp ./include/*.h &

tad: ./src/tad.cpp $(OBJ)
	$(CC) $(OPTIONS) $(DEBUG) -I$(INCLUDEDIR) ./src/tad.cpp $(OBJ) -o tad
	
tad%: ./src/tad%.cpp $(OBJ) clean
	$(CC) $(OPTIONS) $(DEBUG) -I$(INCLUDEDIR) $(OBJ) -o tad $<
	clear

$(LIBDIR)/%.o : $(LIBDIR)/%.cpp $(INCLUDEDIR)/%.h
	$(CC) $(OPTIONS) $(DEBUG) -c -I$(INCLUDEDIR) -o $@ $<

doc:
	doxygen

clean:
	clear
	rm -f $(OBJ) ./salida* ./valgrind* ./difer*
